﻿<html>
<head>

  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="layui/css/layui.css"  media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
  
<script src="layui/layui.js" charset="utf-8"></script>

<style type="text/css">　　
  
</style>　　

</head>
<body>

 <div id=bgground style="width: 500px;height: 330px;margin-top: 100px;margin-left:300px;border: 1px solid gray;padding-top: 100px;padding-left:60px;padding-right:60px">
 
<form class="layui-form">
 
 <div class="layui-form-item">
    <div class="layui-form-item">
    <label class="layui-form-label">单行输入账号</label>
    <div class="layui-input-block">
      <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入账号" class="layui-input">
    </div>
     <div class="layui-form-item">
    <label class="layui-form-label" lay-verify="psss" autocomplete="off">请输入密码</label>
    <div class="layui-input-block">
      <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入密码" class="layui-input">
    </div>
      <input type="radio" name="sex" value="男" title="男" checked="">
      <input type="radio" name="sex" value="女" title="女">
    
    </div>
  </div>
   </div>
  <div class="layui-form-item">
    <button class="layui-btn" lay-submit="" lay-filter="demo2">登录</button>
  </div>
 </form>
 </div>
</body>
<script>
<!-- 下面是一个初始化函数，东西放到form表单里-->
layui.use(['form', 'layedit', 'laydate'], function(){
	  var form = layui.form
	  ,layer = layui.layer
	  ,layedit = layui.layedit
	  ,laydate = layui.laydate;
	  
	  //日期
	  laydate.render({
	    elem: '#date'
	  });
	  laydate.render({
	    elem: '#date1'
	  });
	  
	  //创建一个编辑器
	  var editIndex = layedit.build('LAY_demo_editor');
	 
	  //自定义验证规则
	  form.verify({
	    title: function(value){
	      if(value.length < 5){
	        return '标题至少得5个字符啊';
	      }
	    }
	    ,pass: [
	      /^[\S]{6,12}$/
	      ,'密码必须6到12位，且不能出现空格'
	    ]
	    ,content: function(value){
	      layedit.sync(editIndex);
	    }
	  });

  
  
});
</script>
</html>